﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Campus.Main.Basic.Settings;
using dbcntn;

namespace Campus.Main.ReadWriteUser
{
    public partial class ListView : DefaultForm
    {
        private string Query { get; set; }
        public ListView()
        {
            InitializeComponent();
            aToDb=new ConnectionToDb(Helper.ConnectionString);
        }
        public ListView(string query)
        {
            InitializeComponent();
            aToDb = new ConnectionToDb(Helper.ConnectionString);
            Query = query;
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            MessageBox.Show(Convert.ToString(dataGridView1[e.ColumnIndex,e.RowIndex].Value));
        }

        private void ListView_Load(object sender, EventArgs e)
        {
            aToDb.AddItemDBGridView(dataGridView1, Query);
            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                dataGridView1.Rows[i].Cells[0].Value = i + 1;
            }
        }
    }
}
